package com.example.javalib.agencymode;

/**
 * Created by xiuzhizhu
 * Date: 2021/5/12
 */

public class HouseAgent implements IRentHouse{
    IRentHouse mHouseOwner;    // 中介持有房东的权利
    int mTip = 0;    // 小费

    public HouseAgent(IRentHouse houseOwner) {
        mHouseOwner = houseOwner;
    }

    @Override
    public void visitHouse() {
        if (mTip > 10) {
            mHouseOwner.visitHouse();
        } else {
            System.out.println("小费不够，暂不能看房");
        }
    }

    @Override
    public void argueRent(int rent) {
        mHouseOwner.argueRent(rent);
    }

    @Override
    public void signAgreement() {
        mHouseOwner.signAgreement();
    }

    public void giveTip(int tip) {
        mTip = tip;
    }
}
